<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>文字对齐</title>
    <style>
        div{
            width: 300px;
            height: 30px;
            border: 1px solid red;
            line-height: 30px;
        }
        span{
            display: inline-block;
            vertical-align: middle; 
            width: 8px;
            height: 8px;
            background-color: pink;
            margin-top: -5px;

        }
    </style>
</head>

<body>
    <div>
        <span>
        </span>
        文字对齐
    </div>
</body>

</html>